
package com.insigma.business.qrcode.job.dto;

import cn.hutool.core.date.DateUtil;
import com.alibaba.fastjson.JSONArray;
import com.insigma.business.qrcode.common.vo.BaseDTO;
import lombok.Getter;
import lombok.Setter;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;

import java.util.Date;
import java.util.List;


@Slf4j
@Setter
@Getter
public class JobCandidateResumeDTO extends BaseDTO<String, String, String> {

    private static final long serialVersionUID = 1L;
    
    private String candidateId;

    
    private String name;

    
    private String avatar;

    
    private String email;

    
    private String nativePlace;

    
    private String politicsStatus;

    
    private String honor;

    
    private String certificate;

    private String mobile;

    private String workingYears;

    
    private String gender;

    
    private Date birthday;

    
    private Integer age;

    
    private String residentAddress;

    
    private String residentAdminAreaCode;

    
    private String rootAreaCode;

    
    private String rootAreaValue;

    
    private Date workStartYear;

    
    private String graduateSchoolDictCode;

    
    private String graduateSchool;

    
    private String majorDictCode;

    
    private String major;

    
    private String educationLevelDictCode;

    
    private String educationLevel;

    
    private String workStatus;

    
    private String maritalStatus;

    
    private String politicalOutlookDictCode;

    
    private String politicalOutlook;

    
    private String expectedSalary;

    
    private String expectedCity;

    
    private String expectedPositionTypeId;

    
    private String expectedPositionTypeName;

    
    private String expectedIndustryId;

    
    private String expectedIndustryName;

    
    private String dutyTime;

    
    private String positionType;

    
    private String selfEvaluation;

    
    private String workExperience;

    
    private String specialSkill;

    
    private String extraResumePath;

    private String orgId;

    private String orgName;

    private String recruitPositionId;

    private String recruitPositionName;

    
    private Boolean show;

    private String status;

    
    private String expectedInfo;

    
    private String projectExperience;

    
    private String educationInfo;

    private List<ExpectedInfoRequest> expectedDetail;

    private List<WorkExperienceRequest> workDetail;

    private List<ProjectExperienceRequest> projectDetail;

    private List<EducationInfoRequest> educationDetail;

    public void build() {
        try {
            if (birthday != null) {
                age = (int) (DateUtil.betweenYear(birthday, new Date(), false) + 1);
            }
            if (workStartYear != null) {
                workingYears = String.valueOf(DateUtil.betweenYear(workStartYear, new Date(), true));
            }
            if (StringUtils.isNotBlank(expectedInfo)) {
                expectedDetail = JSONArray.parseArray(expectedInfo, ExpectedInfoRequest.class);
            }

            if (StringUtils.isNotBlank(workExperience)) {
                workDetail = JSONArray.parseArray(workExperience, WorkExperienceRequest.class);
            }

            if (StringUtils.isNotBlank(projectExperience)) {
                projectDetail = JSONArray.parseArray(projectExperience, ProjectExperienceRequest.class);
            }

            if (StringUtils.isNotBlank(educationInfo)) {
                educationDetail = JSONArray.parseArray(educationInfo, EducationInfoRequest.class);
            }
        } catch (Exception e) {
            log.error("简历错误：{}", e);
        }
    }

    public static void main(String[] args) {
        Date date = new Date(1080402678193L);
        long l = DateUtil.betweenYear(date, new Date(), false);
        System.out.println(l);
    }

    public JobCandidateResumeDTO() {
        super();
    }
}
